# app/models/privacy_setting.py
from app import db

class PrivacySetting(db.Model):
    __tablename__ = 'privacy_settings'

    setting_id = db.Column(db.String(36), primary_key=True)
    user_id = db.Column(db.String(36), db.ForeignKey('users.user_id'), nullable=False, unique=True)
    allow_dm_from_all = db.Column(db.Boolean, default=True)
    allow_friend_requests = db.Column(db.Boolean, default=True)
    allow_server_dm = db.Column(db.Boolean, default=True)

    user = db.relationship('User', back_populates='privacy_settings')

    def __repr__(self):
        return f'<PrivacySettings for {self.user.username}>'